import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";

import Path from "node:path";

const resolve = (...args) => Path.resolve(__dirname, ...args);

// https://vite.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "@": resolve("src"),
    },
  },
  plugins: [
    vue(),
    AutoImport({
      include: [/\.[tj]sx?$/, /\.vue/, /\.vue\?vue/],
      imports: [
        "vue",
        "vue-router",
        "@vueuse/core",
        {
          axios: [["default", "axios"]],
        },
      ],
      eslintrc: {
        enabled: true,
        filepath: "./.eslintrc-auto-import.mjs",
        globalsPropValue: true,
      },
      dts: false,
    }),
    Components({
      version: 3,
      directoryAsNamespace: true,
      resolvers: [NaiveUiResolver()],
      dts: false,
    }),
  ],
});
